<script setup >


import {useRoute} from "vue-router";
import {onMounted, ref} from "vue";
import myAxios from "../plugins/MyAxios.js"
import {Toast} from "vant";
import qs from 'qs'
import UserCardList from "../components/UserCardList.vue";


const  route = useRoute();
const {tags}=route.query;
onMounted( async ()=>{
  const userListDate= await myAxios.get('user/search/tags', {
    params: {
      tagNameList: tags
    },
    paramsSerializer: function (params) {
      return qs.stringify(params, {indices:false});
    },
  })
      .then(function (response) {
        console.log('/user/search/tags success',response);
        return response.data?.data;
      })
      .catch(function (error) {
        console.log('/user/search/tags error',error);
      })
 if (userListDate)
 {
   userListDate.forEach(user=>{
     if(user)
     {
       user.tags=JSON.parse(user.tags);
     }
   })
   userList.value = userListDate;
 }

})
const userList = ref([]);


</script>

<template>
  <UserCardList :user-list="userList"/>

</template>

<style scoped>

</style>